Module Scene Props

Tuple Documentation of module_scene_props.py
Each scene prop record contains the following fields:
1) Scene prop id: used for referencing scene props in other files. The prefix spr_ is automatically added before each scene prop id.
2) Scene prop flags. See header_scene_props.py for a list of available flags.
3) Mesh name: Name of the mesh.
4) Physics object name: Name of the collision object associated with the mesh.
5) Triggers: Simple triggers that are associated with the scene prop.

module_scene_props.py write some intro text here

Scene Prop Flags

The following scene prop flags are available for usage:

sokf_add_fire Unused in Native, WFaS, VC and NW. Eventually deprecated. Up4research
sokf_add_light Unused in Native, WFaS, VC and NW. Eventually deprecated. Up4research
sokf_add_smoke Unused in Native, WFaS, VC and NW. Eventually deprecated. Up4research
sokf_destructible makes the scene prop destructible/destroyable.
sokf_dont_move_agent_over Up4research Speculation: Moving scene props are not affecting the agents?
sokf_dynamic Up4research
sokf_dynamic_physics Up4research
sokf_enforce_shadows Up4research
sokf_face_player lets the scene prop always face the player.[1]
sokf_handle_as_flora Up4research
sokf_invisible makes the scene prop invisible. Typically used for invisible barriers and light scene props.
sokf_missiles_not_attached prevents missiles from sticking in the scene prop.[2]
sokf_moveable enables movements for the scene prop - together with its collision mesh[3] - which also get automatically synced with multiplayer clients.[4] The flag prevents the scene prop from casting shadows.[5]
sokf_place_at_origin positions an already placed scene prop such way to always be at entry point 0.[6] Typically used for the player's inventory.
sokf_show_hit_point_bar shows the remaining hit points of the destructible scene prop.
sokf_static_movement has been added for NW. The server runs code in the game engine to detect whether players are looking at a usable prop which gets impacted when the prop is also moveable. The flag reduces the performance impact of this combination if the scene prop movement and collision detection is not very important (like a door that just moves between a few positions, as opposed to a ship with agents on it who wouldn't want to fall off).[7]
sokf_type_ai_limiter marks scene props which prevent movement of the AI but not of the player.
sokf_type_ai_limiter3d same but for 3D objects? Used in VC, Up4research.
sokf_type_barrier marks a simple 2d barrier, typically an invisible scene prop, to restrict the player movements at the scene(?). Up4research.
sokf_type_barrier_leave marks a simple 2d barrier, typically an invisible scene prop, to restrict the player movements at the scene and at which the scene can be leaved via the town menu(?). Up4research.
sokf_type_barrier3d marks a simple 3d barrier, typically an invisible scene prop, to restrict the player movements at the scene(?). Up4research.
sokf_type_container determines that the scene prop can be used as a chest.
sokf_type_ladder causes slow movements on the scene prop? Up4research.
sokf_type_player_limiter Up4research.
spanim_linear Up4research.
spanim_loop_linear Up4research.
spr_hit_points(x) determines how many hitpoints that destructible scene prop has.
spr_use_time(x) determines how long it takes to use the scene prop. Typically used in multiplayer, make sure to set can_use_scene_props_in_single_player = 1 in module.ini to make scene props useable in singleplayer too. Keep in mind that a scene prop needs to have a collision mesh for this to work.[8] This flag is also need to be set to make use of the trigger ti_on_scene_prop_use.[9]

Destroyable Scene Props

Destroyable scene props, ithilienranger, Modding Q&A

Useable Scene Props [10]

Useable scene props are objects with an orange prompt popping up when the player comes close to them. Once it became visible, holding the F-button will fill the progress bar. You can create events for three different stages at using the scene prop:

  1. When the player starts filling it, making use of ti_on_scene_prop_start_use.
  2. When the player cancels filling it, making use of ti_on_scene_prop_cancel_use. Cancel also happen automatically when the scene prop's collision mesh intersects with an agent.
  3. When the player finishes filling it, using ti_on_scene_prop_use. Once the progress bar is filled it will immediately start to fill up again. You can prevent this by using the operation scene_prop_enable_after_time which adds a delay.

For scene props to become usable they should have the scene prop flag spr_use_time among its flags. The unit for the value is time in seconds required to fill the bar. 0 will make activation instant on pressing F, without the need to hold it down. Additionally the trigger ti_on_scene_prop_use is required for prompt to display, even an empty one will suffice but it should exist. Empty trigger also gives the opportunity to use prompt not for prop activating, but for displaying its current health status or slot values to the player since the prompt text updates in real time.

The very possibility to use a prop requires it to have a collision mesh. Not only should you take it into account when adding the prop entry itself, it also allows to disable the usability by disabling the collision mesh via (prop_instance_enable_physics, “:prop”, 0). And even when the collision mesh is enabled, there shouldn’t be any agents touching it (so if you are standing on a usable prop there will be no prompt until you jump off).

The prompt text needs to be set at the script game_get_use_string. Keep in mind that the prompt display has a lower priority over custom overlays so overlapping it with elements of your presentation on top will hide the prompt even if they are transparent.

Normally usable scene props can be activated only in multiplayer game mode, but you can enable them in singlelayer as well by setting the line can_use_scene_props_in_single_player = 1 in your module.ini.

getting using information text, dunde, Modding Q&A

disable scene prop use, Somebody, Modding Q&A

Moveable Scene Props

moving scene props in MP, Vornne, Modding Q&A

Vertex-animated Scene Props

vertex animating scene prop, Lumos, Modding Q&A, meanwhile it is possible though, Dalion.

vertex animated scene prop, HyperCharge (credit), Animating - import / export

usage of prop_instance_deform_in_range for operating the vertex animation seen in brf, Dalion, Mount & Blade Modding Discord

Light Source Scene Props

Keep in mind that there is a limit of 10 light sources for exterior and 4 for interior scenes. You can place many more but they will not paint the terrain. The player model will still reflect light though.[11]

Work in this remark and this remark, as well as this potential workaround.

max point lights, cmpxchg8b, [WB] Warband Script Enhancer v3.2.0 and [WB] Warband Script Enhancer v3.2.0

maximum light stuff, Somebody and cmpxchg8b, Modding Q&A

Scene maximum lightsources, Ruthven and _Sebastian, Modding Q&A, and _Sebastian_, Modding Q&A

Shadows on Scene Props

shadow engine bug (module scene props, connected with collision mesh iirc), _Sebastian_, Modding Q&A

agent shadow, cmpxchg6b, Modding Q&A

Water River Scene Props

water river props, _Sebastian_ and InVain, Modding Q&A, Gotha (credit), problem with river_water, Marko (credit), Modding Q&A, and Invain and Marko, Modding Q&A

Horses and Stairs

Let horses walk stairs, NPC99, Modding Q&A

Scene Prop Variables

Maximum value for each of both variables is 127, Dalion, Mount & Blade Modding Discord. A more general explanation about use of them is also needed.

Scene Prop Variants - Alternative Materials

Alternative material for scene props, Lav, Modding Q&A, Antonis and La Grandmaster, Modding Q&A and Modding Q&A

example code, scene prop prefab, dstn, Mount & Blade Modding Discord

Scene Prop Meta Types, Sub Kind IDs and Variation IDs [12]

Internally, most items on the scene are instances of the same class (mission object) and are even stored in the same collection. What distinguishes them is meta type, sub kind id and two variation ids. Meta type identifies the type of the object. You can distinguish between the following:

  • Meta Type 0: Scene props (placed in Editor)
  • Meta Type 1: Entry points
  • Meta Type 2: Scene items (placed in Editor)
  • Meta Type 3: No idea what this is
  • Meta Type 4: Flora (trees, rocks, ...)
  • Meta Type 5: Passages
  • Meta Type 6: Spawned items (dropped by player)
  • Meta Type 7: Spawned items (created on missile hit)
  • Meta Type 8: Spawned items (dropped on death)
  • Meta Type 9: No idea what this is
  • Meta Type 10: Spawned scene props

The sub kind id is the id of the underlying item (item kind id for items, scene prop id for scene props, etc.). The variation ids are used for various stuff, e.g. for items that hold item mesh variation, for passages menu id, etc. You might have seen or will perhaps see a server error like this:

								
									Synchronization with server failed: trying to recreate existing object (id: %d, meta_type: %d, sub_kind_id: %d, variation_id: %d) with meta_type: %d, sub_kind_id: %d, variation_id: %d, do_prune: %d
								
							

Now you know at least roughly what those fields mean.

Strangely sokf_missiles_not_attached works for scene props placed in the Editor (meta type 0) while the developers noted that it only works for dynamic mission objects. Dynamic mission objects are items that you drop (meta type 6), items that you drop on death (meta type 8), items created by missiles when they hit something (meta type 7) and spawned scene props (meta type 10).

Other Notes

One sided collision mesh, Somebody, Modding Q&A

hard-coded scene props?, Somebody, Modding Q&A